package GUI;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.ScrollPane;

import javax.swing.JFrame;
import javax.swing.JPanel;

import com.sun.java.swing.plaf.gtk.GTKConstants.Orientation;

import Backend.AlgorithmManager;

public class Mainframe extends JFrame{

	private ControlPanel controlpanel = new ControlPanel();
	private MazeArea mazearea = new MazeArea();
	private StatusBar statusbar = new StatusBar();
	private MazeListener mazelistener = new MazeListener();
	private AlgorithmManager amanger = new AlgorithmManager();

	
	public Mainframe(){
		init();
	}
	
	private void init(){
		setDefaultCloseOperation(EXIT_ON_CLOSE);
		setTitle("Amazing Maze Generator");
		setSize(1200, 800);
		setLayout(new BorderLayout());

		mazelistener.setData(controlpanel, statusbar, mazearea);
		controlpanel.setActionListener(mazelistener);
		controlpanel.setComboData(amanger.getAlgos());
		controlpanel.addSizeChangedListener(mazearea);
		
		JPanel tmp1 = new JPanel();
		tmp1.add(controlpanel);
		add(tmp1, BorderLayout.NORTH);
		
		
		
		ScrollPane scr = new ScrollPane();
		scr.add(mazearea);
		scr.setBackground(Color.WHITE);
		add(scr,BorderLayout.CENTER);
		
		add(statusbar, BorderLayout.SOUTH);
		
		
		setVisible(true);
	}
	
}
